<template>
  <div id="app">
    <div :class="cgsTheme">
      <a-config-provider :locale="locale">
        <router-view />
      </a-config-provider>
    </div>
  </div>
</template>

<script>
import {getSysInfo, getVersion} from "./api/system"
import locale from 'ant-design-vue/es/locale/zh_CN';
export default {
  name: 'app',
  components: {

  },
  data(){
    return {
      locale
    }
  },
  created(){
    let _this = this
    getSysInfo().then(res => {
      if(res.data.success){
        let sysInfo = res.data.data
        if(sysInfo.name === ''){
          sysInfo.name = 'CGSCloud'
        }
        _this.$store.commit('updateSysInfo', sysInfo)
        // getVersion().then(res => {
        //     res = res.data
        //     if (res.success) {
        //         const {releaseType} = res.data
        //         if(sysInfo.logo === ''){
        //           sysInfo.logo = '/logo.png'
        //         }
        //         if(releaseType !== "PUBLIC"){
        //           sysInfo.logo = '/logo.png'
        //         }
        //     }
        //     _this.$store.commit('updateSysInfo', sysInfo)
        // })
      }
    })
  },
  computed: {
      cgsTheme() {
          return this.$store?.state?.sysInfo?.theme || 'cgs_light'
      }
  },
}
</script>

<style lang="less">
    @import "./assets/style/portal.less";
    .cgs_light{
        .portalTheme(
            @cgsThemeBackground:#ffffff,
            @cgsContentBackground: #f5f5f5,
            @cgsFontColor: #000000,
            @cgsIconColor: #757575,
            @itemHoverBg: #efefef
        )
    }
    .cgs_dark{
        .portalTheme(
            @cgsThemeBackground:#222C3C,
            @cgsContentBackground: #1C2531,
            @cgsFontColor: #ffffff,
            @cgsIconColor: #f0f0f0,
            @itemHoverBg: #4c85ffaf
        )
    }
</style>